package org.simple.controller;

import org.simple.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jihu
 * date 2022-09-19
 */
@RestController
@RequestMapping("/test")
@RefreshScope
public class SystemTestController {

    @Value("${test.value}")
    public String value;

    @Value("${value.test}")
    public String value2;

    @Autowired
    private RedisService redisService;

    @GetMapping("/get")
    public String test(){
        return value;
    }

    @GetMapping("/get2")
    public String test2(){
        return value2;
    }

    @GetMapping("/get3")
    public String testRedis(){
        redisService.setCacheObject("key","value");
        return "success";
    }
}
